function res = resid_dim5case1_pscc(x,shat_1,S_1,la,u,mu0,phi,kap0,eta0,be,del,d,Pzz,cz,M)
%function solving for equilibrium (given lambda) in case where firms randomize in top productivity 
%state and don't actively sell in other states

al_1=x(1);dim=5;

%match surpluses given behavior in randomization state and otherwise
S_vec=M*(u*ones(dim,1)-cz+be*(1-del)*(1-d)*(-la*ones(dim,1)-Pzz(:,1)*al_1*kap_n_pscc(shat_1,kap0,phi)));

%equilibrium consistency condition for surplus
res=S_vec(1)-S_1;
end